{"builtIn":false,"fileExtension":".cs","id":100091,"items":[{"code":"using System.Threading.Tasks;\nusing NUnit.Framework;\nusing Microsoft.Playwright;\nusing Microsoft.Dynamics365.UIAutomation.Tests.Utilities;\n\nnamespace PlaywrightDemo.FunctionLibrary\n{\n    public class {{{ModuleName}}} \n    {\n        private readonly IPage _page;\n        \n        public {{{ModuleName}}} (IPage page)\n        {\n            _page = page;\n        }\n\n        //Region - Identifiers\n        //EndRegion - Identifiers\n\n\n        //Region - Methods\n        //EndRegion - Method\n\n    }\n}","embeddedCode":false,"functionParameters":[],"id":2251,"name":"PageObjectClassTemplate","templateId":100091},{"code":"        public ILocator {{{ObjectName}}} => _page.GetByTestId(\"{{{ObjectIdentifier}}}\");\n","embeddedCode":false,"functionParameters":[],"id":2252,"name":"PageObjectdentifierTemplate_Id","templateId":100091},{"code":"        private ILocator {{{ObjectName}}} => _page.Locator(\"{{{ObjectIdentifier}}}\");\n","embeddedCode":false,"functionParameters":[],"id":2253,"name":"PageObjectdentifierTemplate_XPath","templateId":100091},{"code":"        private ILocator {{{ObjectName}}} => _page.Locator(\"{{{ObjectIdentifier}}}\");\n","embeddedCode":false,"functionParameters":[],"id":2254,"name":"PageObjectdentifierTemplate_TagName","templateId":100091},{"code":"        private ILocator {{{ObjectName}}} => _page.Locator(\"{{{ObjectIdentifier}}}\");\n","embeddedCode":false,"functionParameters":[],"id":2255,"name":"PageObjectdentifierTemplate_ClassName","templateId":100091},{"code":"        private ILocator {{{ObjectName}}} => _page.Locator(\"{{{ObjectIdentifier}}}\");\n","embeddedCode":false,"functionParameters":[],"id":2256,"name":"PageObjectdentifierTemplate_Name","templateId":100091},{"code":"        private ILocator {{{ObjectName}}} => _page.Locator(\"{{{ObjectIdentifier}}}\");\n","embeddedCode":false,"functionParameters":[],"id":2257,"name":"PageObjectdentifierTemplate_LinkText","templateId":100091},{"code":"        private ILocator {{{ObjectName}}} => _page.Locator(\"{{{ObjectIdentifier}}}\");\n","embeddedCode":false,"functionParameters":[],"id":2258,"name":"PageObjectdentifierTemplate_PartialLinkText","templateId":100091},{"code":"        private ILocator {{{ObjectName}}} => _page.Locator(\"{{{ObjectIdentifier}}}\");\n","embeddedCode":false,"functionParameters":[],"id":2259,"name":"PageObjectdentifierTemplate_AccesibilityId","templateId":100091},{"code":"        //Region - MethodDocumentation\n        //EndRegion - MethodDocumentation\n        public async Task GoToUrl()\n        {\n        \tawait _page.GotoAsync(\"{{{url}}}\");\n        }\n","embeddedCode":false,"functionParameters":[],"id":2260,"name":"TestCaseMethodTemplate_Url","templateId":100091},{"code":"        //Region - MethodDocumentation\n        //EndRegion - MethodDocumentation\n        // this function reports to the console if i run tests locally\n        public async Task AssertUrl (string expectedUrl)\n        {\n            // Get the current URL of the page\n            string currentUrl = _page.Url;\n\n            // Compare the current URL with the expected URL\n            if (!currentUrl.Equals(expectedUrl))\n            {\n                Console.WriteLine($\"Expecting URL - {expectedUrl} - Found {currentUrl}\");\n                Assert.Fail($\"Expecting URL - {expectedUrl} - Found {currentUrl}\");\n            }\n        }\n","embeddedCode":false,"functionParameters":[],"id":2261,"name":"TestCaseMethodTemplate_AssertUrl","templateId":100091},{"code":"        //Region - MethodDocumentation\n        //EndRegion - MethodDocumentation\n     \tpublic async Task {{{FunctionName}}}()\n     \t{\n     \t    // Check if the PasswordInput element is present\n            if (await {{{ObjectName}}}.CountAsync() == 0)\n            {\n                // Log failure with screenshot if the element is not found\n                TestModellerLogger.FailStepWithScreenshot(_page, \"{{{FunctionName}}}\", $\"{{{FunctionName}}} failed. Unable to locate object: {{{ObjectName}}}\");\n                Assert.Fail($\"Unable to locate object: {{{ObjectName}}}\");\n            }\n            \n            await {{{ObjectName}}}.ClickAsync();\n            TestModellerLogger.PassStep(_page, \"{{{FunctionName}}}\");\n     \t}\n","embeddedCode":false,"functionParameters":[],"id":2262,"name":"TestCaseMethodTemplate_Click","templateId":100091},{"code":"        //Region - MethodDocumentation\n        //EndRegion - MethodDocumentation\n         \n        //this example function uses the TestModellerLogger class\n     \tpublic async Task {{{FunctionName}}}(string {{{ParameterName}}})\n     \t{\n     \t    // Check if the PasswordInput element is present\n            if (await {{{ObjectName}}}.CountAsync() == 0)\n            {\n                // Log failure with screenshot if the element is not found\n                TestModellerLogger.FailStepWithScreenshot(_page, \"{{{FunctionName}}}\", $\"{{{FunctionName}}} failed. Unable to locate object: {{{ObjectName}}}\");\n                Assert.Fail($\"Unable to locate object: {{{ObjectName}}}\");\n            }\n            \n            await {{{ObjectName}}}.FillAsync({{{ParameterName}}});\n            TestModellerLogger.PassStep(_page, \"{{{FunctionName}}}\");\n     \t}\n","embeddedCode":false,"functionParameters":[],"id":2263,"name":"TestCaseMethodTemplate_SendKeys","templateId":100091},{"code":"        //Region - MethodDocumentation\n        //EndRegion - MethodDocumentation\n     \tpublic async Task {{{FunctionName}}}(string {{{ParameterName}}})\n     \t{\n     \t    // Check if the PasswordInput element is present\n            if (await {{{ObjectName}}}.CountAsync() == 0)\n            {\n                // Log failure with screenshot if the element is not found\n                TestModellerLogger.FailStepWithScreenshot(_page, \"{{{FunctionName}}}\", $\"{{{FunctionName}}} failed. Unable to locate object: {{{ObjectName}}}\");\n                Assert.Fail($\"Unable to locate object: {{{ObjectName}}}\");\n            }\n            \n            await {{{ObjectName}}}.SelectOptionAsync({{{ParameterName}}});\n            TestModellerLogger.PassStep(_page, \"{{{FunctionName}}}\");\n     \t}\n","embeddedCode":false,"functionParameters":[],"id":2274,"name":"TestCaseMethodTemplate_Select","templateId":100091},{"code":"        public ILocator {{{ObjectName}}} => _page.GetByTestId(\"{{{ObjectIdentifier}}}\");\n","displayName":"GetByTestId","embeddedCode":false,"functionName":"GetByTestId","functionParameters":[],"id":2285,"name":"PageObjectIdentifierTemplate_CustomType","templateId":100091}],"language":"CSharp","languageExtension":".cs","mergeCode":true,"name":"Playwright C# PO","type":"PageObject"}